s = input('Введите скобочную последовательсть: ')
s1 = ''
for i in s:
    if i == '(' or i == '[' or i == '{' or i == '<' or \
            i == ')' or i == ']' or i == '}' or i == '>':
        s1 += i

while '()' in s1 or '[]' in s1 or '{}' in s1 or '<>' in s1:
    s1 = s1.replace('()', '')
    s1 = s1.replace('[]', '')
    s1 = s1.replace('{}', '')
    s1 = s1.replace('<>', '')

if len(s1) == 0:
    print('True')
else:
    print('False')